UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rc8YheHVtA/qLvz8zdH/O40Z0CxabBRw2PigkX+NBHs='
WHERE
key_id = '9aeebfc37a77887ffa702cacd1611f40299be4f684cbdf316e56e8faa74e8ebb'
AND (
token = 'rc8YheHVtA/qLvz8zdH/O40Z0CxabBRw2PigkX+NBHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)