UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RgehRfkQNBapscOUU7+U8Lmmw7L0ekvaFgmdiDZl3qM='
WHERE
key_id = 'aa24de7cc949b71d80399f6541560dd1ff2cc414fe7ced4e4ce50bdb28969602'
AND (
token = 'RgehRfkQNBapscOUU7+U8Lmmw7L0ekvaFgmdiDZl3qM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)