UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'duSI+yHQb1Hjb0/ovGwQEPeEQAAXCbPb8PshIxKpZQc=' 
WHERE 
  key_id = '8b8aaf83284564c62559315f46f8d0b95a3d5f9365086d5b7c4fce56a32961b9' 
  AND (
    token = 'duSI+yHQb1Hjb0/ovGwQEPeEQAAXCbPb8PshIxKpZQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043