UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'icoWrhP6wTC/ILAOAQXDC2Go57NwKPmLBkVXqhSLKMs=' 
WHERE 
  key_id = 'e09b1af6815f2f223acc46f4722f51421585b8211c4768b8b1a6f437698d4a19' 
  AND (
    token = 'icoWrhP6wTC/ILAOAQXDC2Go57NwKPmLBkVXqhSLKMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028