UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FGqt6E66M6LjPHpiD1HMRp3McLosr1lKHQxWSHI6SA4='
WHERE
key_id = '50c9b72bb879e715c99c50b06c3ed051c7807b8a1af1053336f14c3a86340e0b'
AND (
token = 'FGqt6E66M6LjPHpiD1HMRp3McLosr1lKHQxWSHI6SA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)