UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fwOQuDvxuuKwdtHfvCnf/5Z24eltUxI4G7H4OImL/A8=' 
WHERE 
  key_id = '4d4746147301d68ff499179e60654c45b852d8da813e95afd5a7a777d7649f8c' 
  AND (
    token = 'fwOQuDvxuuKwdtHfvCnf/5Z24eltUxI4G7H4OImL/A8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033