UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cjFxXciWsfl4rVljJ2Avo5sCXivmSn9k6ZF8YW7Ulas='
WHERE
key_id = '583c9fdf0f4989818739dc4ac239a9f4dda81dea63cd90d190ae47b516271270'
AND (
token = 'cjFxXciWsfl4rVljJ2Avo5sCXivmSn9k6ZF8YW7Ulas='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)