UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5agW6qmroychbnOhFepY0BMElWVl89vMagkm1Zdz1ww=' 
WHERE 
  key_id = 'ae28deac484e7be7512baccd11abd912ca657d1e7c7e362b3033e55f7d2fac29' 
  AND (
    token = '5agW6qmroychbnOhFepY0BMElWVl89vMagkm1Zdz1ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033