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