UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gv/X1dNE05aAYJKhfxhCBxcMS5RIkGii7e93TaVPpWs='
WHERE
key_id = '8a058ed47316f0788b8c2a66649f9817ef82f5b085aaff103b156fd3bda27049'
AND (
token = 'Gv/X1dNE05aAYJKhfxhCBxcMS5RIkGii7e93TaVPpWs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)