UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iW/VfpKP8SdHGN6J0ydBTWuG8U5gcbcyoukaQ6RPi3I='
WHERE
key_id = 'bd47f20721fbebd691f6e8443b972324ad2a2685fd626f4e9e72e83313ff99bf'
AND (
token = 'iW/VfpKP8SdHGN6J0ydBTWuG8U5gcbcyoukaQ6RPi3I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)