UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cMG3Qymd8nr9nk7alzAEEfgajV3PhHda9jkQEQBYnB8='
WHERE
key_id = 'e5612e7826088044071cb48e174099af96b8cc7e7824135329eb741cdad3fae3'
AND (
token = 'cMG3Qymd8nr9nk7alzAEEfgajV3PhHda9jkQEQBYnB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)