UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7YLnRjBxtbUdqRD40Cot8VQRIAAAIE/mlZovUOMpmkI='
WHERE
key_id = 'a7504c6b32c3b549eb3ebe400706ddbcf987e01151a308b08645fa904ea5800a'
AND (
token = '7YLnRjBxtbUdqRD40Cot8VQRIAAAIE/mlZovUOMpmkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)