UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zdSLH9kwCXd8i6QsqB67J75N23eXn2XetSz6lgAdsOw=' 
WHERE 
  key_id = '28a4d9596a164d6f05dd18123777bc9bcb8a17ecb3eea3f6b5d47c263cccc832' 
  AND (
    token = 'zdSLH9kwCXd8i6QsqB67J75N23eXn2XetSz6lgAdsOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023