UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BMWP8kHjE1o160NNGhUkOKiDRaHIneoicrPEwYLx0EM=' 
WHERE 
  key_id = 'd26d93f35af6f163db343115ad015f427bae8772197218f705243847177cb762' 
  AND (
    token = 'BMWP8kHjE1o160NNGhUkOKiDRaHIneoicrPEwYLx0EM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042