UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TVeKKWKCdvZlSFiBbomXpylwODFI+LadSNHLuVX+dJk=' 
WHERE 
  key_id = 'ac167eea3b7f39fcc9d03a7f87e55c0e4438f35408b3df14ac36f556c0563db8' 
  AND (
    token = 'TVeKKWKCdvZlSFiBbomXpylwODFI+LadSNHLuVX+dJk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032