UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0N30WyBqEy5neVM9Wcv/sP9EOKAUARGLMVxiF6nAnE0='
WHERE
key_id = '661eb290a723dd0136f3dcc6f8454c28976c0e60ff42c58f319098c793829753'
AND (
token = '0N30WyBqEy5neVM9Wcv/sP9EOKAUARGLMVxiF6nAnE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)