UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IbLZgiClJe2nkdEtkfqDd3486TeTyIqz8VFLBGZ6CX8='
WHERE
key_id = 'a03e8457997105590250b6d3c2ec33347114f3886edaff03ff22c16d7cd843d4'
AND (
token = 'IbLZgiClJe2nkdEtkfqDd3486TeTyIqz8VFLBGZ6CX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)