UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hHRykf4VMadQqy/yecIysaSmVQtQnSu7M3XPp5Lfzmg='
WHERE
key_id = 'ff8a4dbbe52b132c52b5f1b7c54cd112597e0f2c3ea77a09016099923ec97f0b'
AND (
token = 'hHRykf4VMadQqy/yecIysaSmVQtQnSu7M3XPp5Lfzmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)