UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qniou7XYMlP+9i4tt/5gg1FV8FcsHEKHgrywliLV+qE=' 
WHERE 
  key_id = 'c2c549cce48bc32fb3adc4dcb95a5c96effe1800f0c37afcfcff6fd81ae53063' 
  AND (
    token = 'qniou7XYMlP+9i4tt/5gg1FV8FcsHEKHgrywliLV+qE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041