UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'afcjlSbkRIevXyTlh8udrnv/jAdtWE7vLZnzhn1O5fY='
WHERE
key_id = 'ef40962a96fe50f44e952dc92e31fec436ef2fcd1c9cd4f75d59706e3c85f730'
AND (
token = 'afcjlSbkRIevXyTlh8udrnv/jAdtWE7vLZnzhn1O5fY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)