UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zwLnQIVT8wsUH9UOx/bkrCArJte3hpv2u9Ri1IrgCn0='
WHERE
key_id = 'bd9cbe5b551b7809d150f992c58219b1451b425b0887a304ec35461837ac764a'
AND (
token = 'zwLnQIVT8wsUH9UOx/bkrCArJte3hpv2u9Ri1IrgCn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)