UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r3iwhpoBHC5ZqUg1Gb/Qa3u9E1uuAR2tgh7NPprX/4I='
WHERE
key_id = 'd9749dc144bd99b61f92beb5e6ade85a202c22483505a54f504f601877765a25'
AND (
token = 'r3iwhpoBHC5ZqUg1Gb/Qa3u9E1uuAR2tgh7NPprX/4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)