UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iA1mP53s+tya3YeS7JJ5JcjSkEhUyWossOIYZWwEnLc='
WHERE
key_id = '87833eba2a57223bbb0953958acc604792c1836e37b58653c2cddeaa6fd4f045'
AND (
token = 'iA1mP53s+tya3YeS7JJ5JcjSkEhUyWossOIYZWwEnLc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)