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