UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xSeXuETlYgjORaFxCuXhLf8cpp1EbdNiiYgld1CyID8='
WHERE
key_id = '991ac477e871dd9707688c422943058bcf413d32cffae73827cf729e388d78ed'
AND (
token = 'xSeXuETlYgjORaFxCuXhLf8cpp1EbdNiiYgld1CyID8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)