UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bUZfkP94bqv8M9Vf6SKCY0d6uVjBH50dB0pToPv+hJ0='
WHERE
key_id = 'e3afc84ba4fcdf780a12d21d488c0e6e5a3d007d31d267de0f029c3b911c3b61'
AND (
token = 'bUZfkP94bqv8M9Vf6SKCY0d6uVjBH50dB0pToPv+hJ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)