UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kd0qik8JxSHOlxICTx8TMhxFCkMbTJsedk4IOcKQAbI='
WHERE
key_id = 'ff58344162fc8609c3dba0e4c34c087f0f5dcb8eefb2fb3e8c2f48222ed3ca2b'
AND (
token = 'kd0qik8JxSHOlxICTx8TMhxFCkMbTJsedk4IOcKQAbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)