UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MFFmLiMcBRPlJObPM9y9pMAJWA88ZLwPSKudVAXmA7Y=' 
WHERE 
  key_id = '051de9b277ec74ccd36443347f01d1566675536507b36760ab7dd94da4332acc' 
  AND (
    token = 'MFFmLiMcBRPlJObPM9y9pMAJWA88ZLwPSKudVAXmA7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040