UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nKRLrNh6WDS0nbJ0WfCKPTtM8StBiHdlOBrCEwnmTGs=' 
WHERE 
  key_id = '3b3bd7b9a91600817ceb4bb4980b9df20847fe2ac207e67e9cd3c952f957ce59' 
  AND (
    token = 'nKRLrNh6WDS0nbJ0WfCKPTtM8StBiHdlOBrCEwnmTGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044